package  
{
	import net.flashpunk.FP;
	import net.flashpunk.graphics.Image;
	import net.flashpunk.graphics.Spritemap;
	import net.flashpunk.Sfx;
	
	/**
	 * ...
	 * @author Donatello
	 */
	
	public class Inspector extends Player
	{
	
		
		[Embed(source = "img/inspectorsheet.png")]
		private const PLAYER_ANIM:Class;
		public var playerAnim:Spritemap;
		
		
		[Embed(source = "snd/magneticfield.mp3")]
		private const INSPECTOR_MP3:Class;
		private var inspectorSfx:Sfx;
		
		private var play:Boolean = false;
		
		public function Inspector(px:Number=305,py:Number=500) 
		{
			
			playerAnim = new Spritemap(PLAYER_ANIM, 33, 48);
			
			playerAnim.add("idle", [1], 10, true);
			playerAnim.add("walking", [3,4,5], 10, true);
			playerAnim.add("jump", [0], 10, false);
			playerAnim.add("power", [6, 7,6,7,6,7,8], 10, false);
		
			x = px;
			y = py;

			this.graphic = playerAnim;
				
			setHitbox(33,40);
						
			playerAnim.play("idle");
			
			inspectorSfx = new Sfx(INSPECTOR_MP3);
			
			
			
		}
		
		override public function actualizar():void {
			
			playerAnim.flipped = flipped;
			
			if (state == "power")
			{
				if(!play)
				{
					inspectorSfx.play();
					play = true;
				}
				if(playerAnim.complete)
				{	
					state = "idle";
					x = 720;
					y = 50;
					play = false;
				}
			}
			
			playerAnim.play(state);
			
		}
		
	}

}